@echo off & setlocal enabledelayedexpansion
call :func
call :func2
::goto :func2

call :str_suiji str
echo %str%

exit /b %errorlevel%

:func
set /a a=2
echo The a is 2
exit /b 0

:func2
set b=Hello Word
echo %b%
exit /b 0

:str_suiji
:a
set str=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
set /a b=%random%%%62
set /a c+=1
for %%i in (!b!) do (
	set q=!q!!str:~%%i,1!
)
if not !c! == 16 goto :a
set %~1=!q!
exit /b 0